<template>
  <view v-if="!isLoading" class="container">
    <contract-service imtype="order" :orderid="order.douyin_order_id" />
    <!-- <movable-area class="movable-area">
	        <movable-view class="movable-view" :x="x" :y="y" direction="all">
	  		<button class="newProblem"  open-type="im"  :data-im-id="imId"  @im="imCallback"  @error="onimError">
	            <text>客服</text>
	          </button>
	        </movable-view>
	  </movable-area>
	  <movable-area class="movable-area1">
	        <movable-view class="movable-view" :x="x" :y="y" direction="all">
	  		<button class="newProblem"  @click="phoneclick">
	            <text>热线客服</text>
	          </button>
	        </movable-view>
	  </movable-area> -->
    <view class="header themecolor">
      <!-- 订单状态 -->
      <view class="order-status">
        <view class="status-icon">
          <!-- 进行中的订单 -->
          <block v-if="order.order_status == OrderStatusEnum.NORMAL.value">
            <!-- 待支付 -->
            <block v-if="order.pay_status == PayStatusEnum.PENDING.value">
              <image
                class="image"
                src="/static/order/status/wait_pay.png"
                mode="aspectFit"
              ></image>
            </block>
            <!-- 待发货 -->
            <block
              v-else-if="
                order.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value
              "
            >
              <image
                class="image"
                src="/static/order/status/wait_deliver.png"
                mode="aspectFit"
              ></image>
            </block>
            <!-- 待收货 -->
            <block
              v-else-if="
                order.receipt_status == ReceiptStatusEnum.NOT_RECEIVED.value
              "
            >
              <image
                class="image"
                src="/static/order/status/wait_receipt.png"
                mode="aspectFit"
              ></image>
            </block>
          </block>
          <!-- 已完成 -->
          <block v-if="order.order_status == OrderStatusEnum.COMPLETED.value">
            <image
              class="image"
              src="/static/order/status/received.png"
              mode="aspectFit"
            ></image>
          </block>
          <block v-if="order.order_status == OrderStatusEnum.REFUND.value">
            <image
              class="image"
              src="/static/order/status/received.png"
              mode="aspectFit"
            ></image>
          </block>
          <block v-if="order.order_status == OrderStatusEnum.REFUNDED.value">
            <image
              class="image"
              src="/static/order/status/received.png"
              mode="aspectFit"
            ></image>
          </block>
          <!-- 已取消/待取消 -->
          <block
            v-if="
              order.order_status == OrderStatusEnum.CANCELLED.value ||
              order.order_status == OrderStatusEnum.APPLY_CANCEL.value
            "
          >
            <image
              class="image"
              src="/static/order/status/close.png"
              mode="aspectFit"
            ></image>
          </block>
        </view>
        <view class="status-text">
          <text>{{ order.state_text }}</text>
        </view>
      </view>
      <!-- 下一步操作 -->
    </view>

    <!-- 预约信息  -->
    <view
      class="delivery-address i-card"
      v-if="order.delivery_status1 != DeliveryStatusEnum.NOT_DELIVERED.value"
    >
      <view class="link-title"
        ><u-icon name="clock" color="#000" size="50"></u-icon> 预约信息</view
      >
      <view class="link-man">
        预约人：<text class="name">{{ order.address.name }}</text>
        <text class="phone">{{ order.address.phone }}</text>
      </view>
      <view class="address">
        服务地址：<text
          class="region"
          v-for="(region, idx) in order.address.region"
          :key="idx"
          >{{ region }}</text
        >
        <text class="detail">{{ order.address.detail }}</text>
      </view>
      <view class="address">
        服务时间：<text>{{ order.service_time.substr(0, 16) }}</text>
      </view>
    </view>

    <!-- 商品列表 -->
    <view class="goods-list i-card">
      <view class="goods-item" v-for="(goods, idx) in order.goods" :key="idx">
        <view class="goods-main" @click="handleTargetGoods(goods.goods_id)">
          <!-- 商品图片 -->
          <view class="goods-image">
            <image
              class="image"
              :src="goods.goods_image"
              mode="aspectFill"
            ></image>
          </view>
          <!-- 商品信息 -->
          <view class="goods-content">
            <view class="goods-title"
              ><text class="twoline-hide">{{ goods.goods_name }}</text></view
            >
            <view class="goods-props clearfix">
              <view
                class="goods-props-item"
                v-for="(props, idx) in goods.goods_props"
                :key="idx"
              >
                <text>{{ props.value.name }}</text>
              </view>
            </view>
          </view>
          <!-- 交易信息 -->
          <view class="goods-trade">
            <view class="goods-price">
              <text class="unit">￥</text>
              <text class="value">{{
                goods.is_user_grade
                  ? goods.grade_goods_price
                  : goods.goods_price
              }}</text>
            </view>
            <view class="goods-num">
              <text>×{{ goods.total_num }}</text>
            </view>
          </view>
        </view>
        <!-- 商品售后 -->
        <view class="goods-refund">
          <!-- <text v-if="goods.refund" class="stata-text">已申请退款</text> -->
          <block
            v-if="
              order.pay_status == PayStatusEnum.SUCCESS.value &&
              order.order_status == OrderStatusEnum.NORMAL.value
            "
          >
            <block
              v-if="
                order.delivery_status1 != DeliveryStatusEnum.RECEIVED.value &&
                order.delivery_status1 != DeliveryStatusEnum.PAYED.value
              "
            >
              <view
                class="action-btn"
                @click.stop="handleApplyRefund(goods.order_goods_id)"
                >申请退款</view
              >
            </block>
          </block>
        </view>
      </view>
    </view>
    <!-- <view class="dorder">
			<consume-card
			  order-id="213"
			  ​bind:error="handleError"
			  bind:consume="orderChangeHandler"
			  bind:refund="handleRefund"
			  bind:applyrefund="applyRefund"
			></consume-card>
		</view> -->
    <!-- 订单信息 -->
    <view class="order-info i-card">
      <view class="info-item">
        <view class="item-lable">订单编号</view>
        <view class="item-content">
          <text>{{ order.order_no }}</text>
          <view class="act-copy" @click="handleCopy(order.order_no)">
            <text>复制</text>
          </view>
        </view>
      </view>
      <view class="info-item">
        <view class="item-lable">下单时间</view>
        <view class="item-content">
          <text>{{ order.create_time }}</text>
        </view>
      </view>
      <view class="info-item">
        <view class="item-lable">买家留言</view>
        <view class="item-content">
          <text>{{ order.buyer_remark ? order.buyer_remark : "--" }}</text>
        </view>
      </view>
    </view>

    <!-- 结算信息 -->
    <view class="trade-info i-card">
      <view class="info-item">
        <view class="item-lable">订单金额</view>
        <view class="item-content">
          <text>￥{{ order.total_price }}</text>
        </view>
      </view>
      <view v-if="order.coupon_money > 0" class="info-item">
        <view class="item-lable">优惠券抵扣</view>
        <view class="item-content">
          <text>-￥{{ order.coupon_money }}</text>
        </view>
      </view>
      <view v-if="order.points_money > 0" class="info-item">
        <view class="item-lable">{{ setting.points_name }}抵扣</view>
        <view class="item-content">
          <text>-￥{{ order.points_money }}</text>
        </view>
      </view>
      <!-- <view class="info-item">
        <view class="item-lable">运费</view>
        <view class="item-content">
          <text>+￥{{ order.express_price }}</text>
        </view>
      </view> -->
      <view v-if="order.update_price.value != '0.00'" class="info-item">
        <view class="item-lable">后台改价</view>
        <view class="item-content">
          <text>{{ order.update_price.symbol }}</text>
          <text>￥{{ order.update_price.value }}</text>
        </view>
      </view>
      <view class="divider"></view>
      <view class="trade-total">
        <text class="lable">实付款</text>
        <view class="goods-price">
          <text class="unit">￥</text>
          <text class="value">{{ order.pay_price }}</text>
        </view>
      </view>
    </view>

    <!-- 底部操作按钮 -->
    <view
      v-if="order.order_status != OrderStatusEnum.CANCELLED.value"
      class="footer-fixed"
    >
      <view class="btn-wrapper">
        <block v-if="order.order_status == OrderStatusEnum.NORMAL.value">
          <block
            v-if="
              order.delivery_status1 == DeliveryStatusEnum.NOT_DELIVERED.value
            "
          >
            <view
              class="btn-item active"
              v-if="order.pay_status == PayStatusEnum.SUCCESS.value"
              @click="handleYuyue(order.order_id)"
              >立即预约</view
            >
          </block>

          <block
            v-if="
              order.delivery_status1 == DeliveryStatusEnum.DELIVERED.value ||
              order.delivery_status1 == DeliveryStatusEnum.ORDERED.value
            "
          >
            <block v-if="order.pay_status == PayStatusEnum.SUCCESS.value">
              <!-- <view
                style="margin-right: 20rpx"
                class="btn-item"
                @click="onCancel(order.order_id)"
                >取消预约
              </view> -->
              <view class="btn-item active" @click="handleYuyue(order.order_id)"
                >修改预约信息</view
              >
            </block>
          </block>
          <!-- 
					   <block v-if="order.delivery_status1 == DeliveryStatusEnum.DELIVERED.value">
					   	<view class="yiyuyue" v-if="order.pay_status == PayStatusEnum.SUCCESS.value">已预约</view>
					   </block>
					 -->
          <!-- <view v-if="order.delivery_status == DeliveryStatusEnum.DELIVERED.value && order.receipt_status == ReceiptStatusEnum.NOT_RECEIVED.value"
				class="action-btn" @click="onReceipt(order.order_id)">确认完成</view> -->
        </block>
        <!-- 已支付进行中的订单 -->
        <!-- <block v-if="order.order_status != OrderStatusEnum.APPLY_CANCEL.value">
					<block
						v-if="order.pay_status == PayStatusEnum.SUCCESS.value && order.delivery_status == DeliveryStatusEnum.NOT_DELIVERED.value">

					</block>
				</block>
				<view v-else class="f-28 col-8">取消申请中</view> -->
        <!-- 未支付的订单 -->
        <block
          v-if="
            OrderStatusEnum.NORMAL.value == order.order_status &&
            order.pay_status == PayStatusEnum.PENDING.value
          "
        >
          <view class="btn-item active" @click="onPay()">立即支付</view>
        </block>
        <!-- 完成服务 -->
        <!-- <block
          v-if="
            [
              OrderStatusEnum.NORMAL.value,
              OrderStatusEnum.COMPLETED.value,
            ].includes(order.order_status) &&
            order.delivery_status1 == DeliveryStatusEnum.RECEIVED.value
          "
        >
          <view class="btn-item active" @click="onReceipt(order)"
            >完成服务</view
          >
        </block> -->
        <!-- 订单评价 -->
        <!-- <block v-if="
            [OrderStatusEnum.NORMAL.value,OrderStatusEnum.COMPLETED.value].includes(order.order_status)&&order.delivery_status1 == DeliveryStatusEnum.PAYED.value &&
            order.is_comment == 0
          ">
					<view class="btn-item " @click="handleTargetComment(order.order_id)">评价</view>
				</block> -->
      </view>
    </view>

    <!-- 支付方式弹窗 -->
    <u-popup
      v-model="showPayPopup"
      mode="bottom"
      border-radius="26"
      :closeable="true"
    >
      <view class="pay-popup">
        <view class="title">请选择支付方式</view>
        <view class="pop-content">
          <!-- 微信支付 -->
          <!-- #ifdef MP-WEIXIN -->
          <view
            class="pay-item dis-flex flex-x-between"
            @click="onSelectPayType(PayTypeEnum.WECHAT.value)"
          >
            <view class="item-left dis-flex flex-y-center">
              <view class="item-left_icon wechat">
                <text class="iconfont icon-wechat-pay"></text>
              </view>
              <view class="item-left_text">
                <text>{{ PayTypeEnum.WECHAT.name }}</text>
              </view>
            </view>
          </view>
          <!-- #endif -->
          <!-- 余额支付 -->
          <view
            class="pay-item dis-flex flex-x-between"
            @click="onSelectPayType(PayTypeEnum.BALANCE.value)"
          >
            <view class="item-left dis-flex flex-y-center">
              <view class="item-left_icon balance">
                <text class="iconfont icon-balance-pay"></text>
              </view>
              <view class="item-left_text">
                <text>{{ PayTypeEnum.BALANCE.name }}</text>
              </view>
            </view>
          </view>
        </view>
      </view>
    </u-popup>
    <view class="yypop" v-if="showYYPopup">
      <view class="yyview">
        <image src="../../static/ice.png" class="timg" mode="widthFix"></image>
        <view class="ytit"> 您有未使用的订单，立即预约服务吧~</view>
        <view class="tun" v-if="order.expiration_time">
          此券包可屯至<text>{{ order.expiration_time }}</text></view
        >
        <view class="tun"> 有效期前完成预约服务即可</view>
        <view class="btns">
          <u-button
            @click="showYYPopup = false"
            size="normal"
            shape="circle"
            type="info"
            plain
            >暂不预约</u-button
          >
          <u-button
            @click="yyConfirmBtn(order)"
            size="normal"
            shape="circle"
            type="primary"
            >立即预约</u-button
          >
        </view>
      </view>
    </view>

    <sheet />
  </view>
</template>

<script>
import {
  DeliveryStatusEnum,
  DeliveryTypeEnum,
  OrderStatusEnum,
  PayStatusEnum,
  PayTypeEnum,
  ReceiptStatusEnum,
} from "@/common/enum/order";
import * as OrderApi from "@/api/order";
import { wxPayment } from "@/core/app";
import * as CheckoutApi from "@/api/checkout";
export default {
  data() {
    return {
      // 枚举类
      DeliveryStatusEnum,
      DeliveryTypeEnum,
      OrderStatusEnum,
      PayStatusEnum,
      PayTypeEnum,
      ReceiptStatusEnum,
      // 当前订单ID
      orderId: null,
      orderNo: "",
      amount: 0,
      // 加载中
      isLoading: true,
      // 当前订单详情
      order: {},
      // 当前设置
      setting: {},
      // 支付方式弹窗
      showPayPopup: false,
      showYYPopup: false,
      mode: 1,
      status: 1,
      refundId: "",
      imId: "hjm616161",
    };
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad({ orderId }) {
    // 当前订单ID
    this.orderId = orderId;
    console.log(this.orderId);
    // 获取当前订单信息
  },
  onShow() {
    this.getOrderDetail();
  },
  methods: {
    //核销订单后触发​
    orderChangeHandler() {},
    //点击申请退款时触发的方法​
    applyRefund(event) {
      const { orderId } = event.detail;
      const extra = {
        orderId,
      }; // 开发者需要透传的参数，可自定义内容
      return new Promise((resolve) => {
        resolve(extra);
      });
    },

    // 申请退款时触发的方法​
    handleRefund(event) {
      console.log(event);
      const app = this;
      const { status, result } = event.detail;
      if (status === "success") {
        const { refundId, outRefundNo } = result;

        OrderApi.refund(app.orderId, {
          refundId: refundId,
        }).then((result) => {});
      } else {
        const { errMsg } = result;
      }
    },
    handleError(event) {
      console.log("handleError-event", event);
      // const {
      // 	errNo,
      // 	errMsg
      // } = event.detail
    },
    getGoodsInfo(event) {
      console.log("getGoodsInfo-event", event);
      return new Promise((resolve) => {
        // 在此处开发者可以进行商品数据请求，获取商品信息，然后将商品信息传入 resolve 函数
        resolve({
          minLimits: 1,
          maxLimits: 2,
          dateRule: "周一至周日可用",
          relationType: 1,
          validation: {
            phoneNumber: {
              required: true, // 手机号是否必填
            },
            reservationType: 1,
            reservationCount: 2,
          },
          // 在 bind:getgoodsinfo 返回的 promise 的 resolve 函数中新增 marketingVersion 字段
          marketingVersion: 2,
        });
      });
    },
    userLogin(event) {
      console.log("event", event);
      return new Promise((resolve, reject) => {
        tt.login({
          success() {
            // 用户登录成功并获取信息，则调用 resolve 函数，跳转至提单页
            resolve();
          },
          fail() {
            // 用户登录失败，则跳转提单页失败
            reject();
          },
        });
      });
    },
    handleUnrealPay(event) {
      console.log("pay-event: " + event.detail);
      console.log(event);
      const { status, orderId, outOrderNo, result } = event.detail;
      if (status === "success") {
        const { code } = result;
        if (code === 0) {
          console.log("redirectTo调用成功 ", res);
        } else {
          // 支付失败（超时、取消、关闭）
          uni.showToast({
            title: "支付失败，请重试",
            icon: "none",
          });
        }
      } else {
        const { errMsg } = result;
      }
    },
    // 获取当前订单信息
    getOrderDetail() {
      const app = this;
      app.isLoading = true;
      OrderApi.detail(app.orderId).then((result) => {
        console.log(result);
        app.order = result.data.order;
        app.setting = result.data.setting;
        app.orderNo = result.data.order.order_no;
        app.amount = result.data.order.pay_price * 100;
        app.isLoading = false;
        app.refundId = result.data.order.douyin_refund_id;
        if (
          app.order.order_status == OrderStatusEnum.NORMAL.value &&
          app.order.delivery_status1 ==
            DeliveryStatusEnum.NOT_DELIVERED.value &&
          app.order.pay_status == PayStatusEnum.SUCCESS.value
        ) {
          app.yuyuePopUp(app.order);
        }
      });
    },
    yuyuePopUp(order) {
      const app = this;
      this.showYYPopup = true;
      return false;
      // uni.showModal({
      //   title: "温馨提示",
      //   content: "此服务您尚未预约~",
      //   // showCancel: false,
      //   confirmText: "立即预约",
      //   cancelText: "稍后",
      //   success: (res) => {
      //     if (res.confirm) {
      //       app.handleYuyue(order.order_id);
      //     }
      //   },
      // });
    },
    yyConfirmBtn(order) {
      const app = this;
      this.showYYPopup = false;
      app.handleYuyue(order.order_id);
    },
    // 复制指定内容
    handleCopy(value) {
      const app = this;
      uni.setClipboardData({
        data: value,
        success() {
          app.$toast("复制成功");
        },
      });
    },

    // 跳转到物流跟踪页面
    handleTargetExpress() {
      this.$navTo("pages/order/express/index", {
        orderId: this.orderId,
      });
    },

    // 跳转到商品详情页面
    handleTargetGoods(goodsId) {
      this.$navTo("pages/goods/detail", {
        goodsId,
      });
    },

    // 跳转到申请售后页面
    handleApplyRefund(orderGoodsId) {
      console.log("orderGoodsId:", orderGoodsId);
      this.$navTo("pages/refund/apply", {
        orderGoodsId,
      });
    },
    onCancel(orderId) {
      const app = this;
      uni.showModal({
        title: "友情提示",
        content: "确认要取消该预约订单吗？",
        success(o) {
          if (o.confirm) {
            CheckoutApi.cancelbook({
              orderId,
              reason: "其他",
            })
              .then((result) => {
                // 显示成功信息
                app.$toast(result.message);
                setTimeout(() => {
                  app.getOrderDetail();
                }, 1000);
              })
              .catch((result) => {
                app.$error(result.message);
              });
          }
        },
      });
    },
    handleYuyue(orderId) {
      this.$navTo("pages/order/yuyue", {
        orderId,
      });
    },
    onRefund(orderId) {
      const app = this;
      uni.showModal({
        title: "友情提示",
        content: "确认要退款吗？",
        success(o) {
          if (o.confirm) {
            OrderApi.refund(orderId)
              .then((result) => {
                // 显示成功信息
                app.$toast(result.message);
                // 刷新当前订单数据
                //app.getOrderDetail()
              })
              .catch((result) => {
                app.$error(result.message);
              });
          }
        },
      });
    },
    // 确认收货
    onReceipt(order) {
      const app = this;
      tt.confirm({
        deliveryId: order.douyin_delivery_id,
        serviceId: 5,
        success(res) {
          console.log("success执行了", res);
          OrderApi.receipt(order.order_id).then((result) => {
            // 显示成功信息
            app.$success(result.message);
            // 刷新订单列表
            setTimeout(() => {
              app.getOrderDetail();
            }, 1000);
          });
        },
        fail(err) {
          console.log("fail执行了", err);
        },
        complete(res) {
          console.log("complete执行了", res);
        },
      });
      // uni.showModal({
      //   title: "友情提示",
      //   content: "确认收到商品了吗？",
      //   success(o) {
      //     if (o.confirm) {
      //       OrderApi.receipt(orderId).then((result) => {
      //         // 显示成功信息
      //         app.$success(result.message);
      //         // 刷新当前订单数据
      //         app.getOrderDetail();
      //       });
      //     }
      //   },
      // });
    },

    // 点击去支付
    onPay() {
      const app = this;
      // 显示支付方式弹窗
      if (!this.order.douyin_order_id)
        return app.$error("订单未创建成功，请重新下单");
      let canPay = tt.canIUse("continueToPay");
      //console.log(canPay);
      tt.continueToPay({
        orderId: app.order.douyin_order_id,
        //outOrderNo: data.order_id,
        success(res) {
          const { orderId, outOrderNo } = res;
          console.log("success res", res);
          console.log("orderId", orderId, "outOrderNo", outOrderNo);
          CheckoutApi.query({
            orderId: app.order.order_id,
          });
          setTimeout(() => {
            app.getOrderDetail();
          }, 1000);
          return app.$error("支付成功");
        },
        fail(res) {
          const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
          //console.log("失败:",res);
          if (errLogId) {
            console.log("查询订单信息失败", errNo, errMsg, errLogId);
            return app.$error(errMsg);
          }
          if (orderId || outOrderNo) {
            console.log("支付失败", errNo, errMsg, orderId, outOrderNo);
            return app.$error("支付失败");
          }
        },
      });
      //this.showPayPopup = true
    },

    // 选择支付方式
    onSelectPayType(payType) {
      const app = this;
      // 隐藏支付方式弹窗
      this.showPayPopup = false;
      // 发起支付请求
      OrderApi.pay(app.orderId, payType)
        .then((result) => app.onSubmitCallback(result))
        .catch((err) => err);
    },

    // 订单提交成功后回调
    onSubmitCallback(result) {
      const app = this;
      // 发起微信支付
      if (result.data.pay_type == PayTypeEnum.WECHAT.value) {
        wxPayment(result.data.payment)
          .then(() => {
            app.$success("支付成功");
            setTimeout(() => {
              app.getOrderDetail();
            }, 1500);
          })
          .catch((err) => {
            app.$error("订单未支付");
          })
          .finally(() => {
            app.disabled = false;
          });
      }
      // 余额支付
      if (result.data.pay_type == PayTypeEnum.BALANCE.value) {
        app.$success("支付成功");
        app.disabled = false;
        setTimeout(() => {
          // 刷新当前订单数据
          app.getOrderDetail();
        }, 1500);
      }
    },

    // 跳转到订单评价页
    handleTargetComment(orderId) {
      this.$navTo("pages/order/comment/index", {
        orderId,
      });
    },
    imCallback(e) {
      console.log("跳转IM客服成功", e.detail);
    },
    onimError(e) {
      console.log("拉起IM客服失败", e.detail);
    },
    phoneclick() {
      tt.makePhoneCall({
        phoneNumber: "4009673811",
        success: function () {},

        fail(err) {
          console.log(err.errMsg);
        },
      });
    },
  },
};
</script>

<style>
page {
  background: #f4f4f4;
}
</style>
<style lang="scss" scoped>
.container {
  padding-bottom: constant(env(safe-area-inset-bottom) + 106rpx + 6rpx);
  padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx + 6rpx);
}

// 页面顶部
.header {
  display: flex;
  justify-content: space-between;
  height: 280rpx;
  padding: 56rpx 30rpx 0 30rpx;

  .order-status {
    display: flex;
    align-items: center;
    height: 128rpx;

    .status-icon {
      width: 128rpx;
      height: 128rpx;

      .image {
        display: block;
        width: 100%;
        height: 100%;
      }
    }

    .status-text {
      padding-left: 20rpx;
      color: #fff;
      font-size: 38rpx;
      font-weight: bold;
    }
  }

  .next-action {
    display: flex;
    align-items: center;
    height: 128rpx;

    .action-btn {
      min-width: 152rpx;
      height: 56rpx;
      padding: 0 30rpx;
      line-height: 56rpx;
      background-color: #fff;
      text-align: center;
      border-radius: 28rpx;
      border-color: rgb(102, 102, 102);
      cursor: pointer;
      user-select: none;
      color: #c7a157;
    }
  }
}

// 通栏卡片
.i-card {
  background: #fff;
  padding: 24rpx 24rpx;
  width: 94%;
  box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
  margin: 0 auto 20rpx auto;
  border-radius: 20rpx;
}

// 收货地址
.delivery-address {
  margin-top: -50rpx;

  .link-title {
    color: #000;
    font-size: 40rpx;

    /deep/ .u-icon {
      position: relative;
      top: 4rpx;
      margin-right: 10rpx;
    }
  }

  .link-man {
    margin-top: 20rpx;
    line-height: 46rpx;
    color: #333;
    font-size: 32rpx;

    .name {
      margin-right: 10rpx;
    }
  }

  .address {
    margin-top: 12rpx;
    color: #333;
    font-size: 28rpx;

    .detail {
      margin-left: 6rpx;
    }
  }
}

// 物流公司
.express {
  display: flex;
  align-items: center;

  .main {
    flex: 1;
  }

  .info-item {
    display: flex;
    margin-bottom: 24rpx;

    &:last-child {
      margin-bottom: 0;
    }

    .item-lable {
      display: flex;
      align-items: center;
      font-size: 24rpx;
      color: #999;
      margin-right: 30rpx;
    }

    .item-content {
      flex: 1;
      display: flex;
      align-items: center;
      font-size: 26rpx;
      color: #333;

      .act-copy {
        margin-left: 20rpx;
        padding: 2rpx 20rpx;
        font-size: 22rpx;
        color: #666;
        border: 1rpx solid #c1c1c1;
        border-radius: 16rpx;
      }
    }
  }

  // 右侧箭头
  .right-arrow {
    margin-left: 16rpx;
    // color: #777;
    font-size: 26rpx;
  }
}

// 商品列表
.goods-list {
  // 商品项
  .goods-item {
    margin-bottom: 40rpx;

    &:last-child {
      margin-bottom: 0;
    }

    // 商品信息
    .goods-main {
      display: flex;
    }

    // 商品图片
    .goods-image {
      width: 180rpx;
      height: 180rpx;

      .image {
        display: block;
        width: 100%;
        height: 100%;
        border-radius: 8rpx;
      }
    }

    // 商品内容
    .goods-content {
      flex: 1;
      padding-left: 16rpx;
      display: flex;
      justify-content: space-between;
      flex-direction: column;
      .goods-title {
        font-size: 26rpx;
        max-height: 76rpx;
      }

      .goods-props {
        margin-top: 14rpx;
        height: 40rpx;
        color: #ababab;
        font-size: 24rpx;
        overflow: hidden;

        .goods-props-item {
          display: inline-block;
          margin-right: 14rpx;
          padding: 4rpx 16rpx;
          border-radius: 12rpx;
          background-color: #f5f5f5;
          width: auto;
        }
      }
    }

    // 交易信息
    .goods-trade {
      padding-top: 16rpx;
      width: 150rpx;
      text-align: right;
      color: $uni-text-color-grey;
      font-size: 26rpx;

      .goods-price {
        vertical-align: bottom;
        margin-bottom: 16rpx;

        .unit {
          margin-right: -2rpx;
          font-size: 24rpx;
        }
      }
    }

    // 商品售后
    .goods-refund {
      display: flex;
      justify-content: flex-end;

      .stata-text {
        font-size: 24rpx;
        color: #999;
      }

      .action-btn {
        border-radius: 10rpx;
        padding: 8rpx 26rpx;
        font-size: 28rpx;
        color: #fb5555;
        border: 1rpx solid #fb5555;
      }
    }
  }
}

// 订单信息
.order-info {
  .info-item {
    display: flex;
    margin-bottom: 24rpx;

    &:last-child {
      margin-bottom: 0;
    }

    .item-lable {
      display: flex;
      align-items: center;
      font-size: 24rpx;
      color: #999;
      margin-right: 30rpx;
    }

    .item-content {
      flex: 1;
      display: flex;
      align-items: center;
      font-size: 26rpx;
      color: #333;

      .act-copy {
        margin-left: 20rpx;
        padding: 2rpx 20rpx;
        font-size: 22rpx;
        color: #666;
        border: 1rpx solid #c1c1c1;
        border-radius: 16rpx;
      }
    }
  }
}

// 交易信息
.trade-info {
  .info-item {
    display: flex;
    margin-bottom: 24rpx;

    .item-lable {
      font-size: 24rpx;
      color: #999;
      margin-right: 24rpx;
    }

    .item-content {
      flex: 1;
      font-size: 26rpx;
      color: #333;
      text-align: right;
    }
  }

  .divider {
    height: 1rpx;
    background: #f1f1f1;
    margin-bottom: 24rpx;
  }

  .trade-total {
    display: flex;
    justify-content: flex-end;

    .goods-price {
      margin-left: 12rpx;
      vertical-align: bottom;
      color: $uni-text-color-active;

      .unit {
        margin-right: -2rpx;
        font-size: 24rpx;
      }
    }
  }
}

/* 底部操作栏 */

.footer-fixed {
  position: fixed;
  bottom: var(--window-bottom);
  left: 0;
  right: 0;
  z-index: 11;
  box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
  background: #fff;

  // 设置ios刘海屏底部横线安全区域
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);

  .btn-wrapper {
    height: 106rpx;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 30rpx;
  }

  .yiyuyue {
    color: #fff;
    font-size: 38rpx;
    font-weight: bold;
    width: 100%;
    color: #f00;
    text-align: center;
    letter-spacing: 5rpx;
  }

  .btn-item {
    width: 100%;
    border-radius: 16rpx;
    padding: 20rpx 20rpx;
    font-size: 34rpx;
    color: #383838;
    text-align: center;
    border: 1rpx solid #a8a8a8;

    &.active {
      color: #fff;
      border: none;
      background: linear-gradient(to right, #f9211c, #ff6335);
    }
  }
}

// 弹出层-支付方式
.pay-popup {
  padding: 24rpx;

  .title {
    font-size: 30rpx;
    margin-bottom: 50rpx;
    font-weight: bold;
    text-align: center;
  }

  .pop-content {
    min-height: 260rpx;
    padding: 0 10rpx;

    .pay-item {
      padding: 20rpx 35rpx;
      font-size: 28rpx;
      border-bottom: 1rpx solid #f1f1f1;

      &:last-child {
        border-bottom: none;
      }

      .item-left_icon {
        margin-right: 20rpx;
        font-size: 32rpx;

        &.wechat {
          color: #00c800;
        }

        &.balance {
          color: #ff9700;
        }
      }
    }
  }
}

.movable-area {
  // 保持在右下角
  margin-top: 600rpx;
  margin-left: 0rpx;
  height: calc(100vh - 300rpx);
  width: calc(100vw - 150rpx);
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  position: fixed;
  z-index: 99999999;
  pointer-events: none; //此处要加，鼠标事件可以渗透

  .movable-view {
    width: 100rpx;
    height: 100rpx;
    pointer-events: auto; //恢复鼠标事件

    .newProblem {
      width: 100rpx;
      height: 100rpx;
      display: flex;
      justify-content: center;
      flex-direction: column;
      align-items: center;
      background: #ffffff;
      border-radius: 50%;
      border: 1px solid #a6a6a6;

      image {
        width: 30rpx;
        height: 30rpx;
      }

      text {
        margin-top: 10rpx;
        font-size: 20rpx;
        font-family: PingFangSC-Semibold, PingFang SC;
        font-weight: 600;
        color: #000000;
      }
    }
  }
}

.movable-area1 {
  // 保持在右下角
  margin-top: 700rpx;
  margin-left: 0rpx;
  height: calc(100vh - 400rpx);
  width: calc(100vw - 150rpx);
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  position: fixed;
  z-index: 99999999;
  pointer-events: none; //此处要加，鼠标事件可以渗透

  .movable-view {
    width: 100rpx;
    height: 100rpx;
    pointer-events: auto; //恢复鼠标事件

    .newProblem {
      width: 100rpx;
      height: 100rpx;
      display: flex;
      justify-content: center;
      flex-direction: column;
      align-items: center;
      background: #ffffff;
      border-radius: 50%;
      border: 1px solid #a6a6a6;

      image {
        width: 30rpx;
        height: 30rpx;
      }

      text {
        margin-top: 10rpx;
        font-size: 20rpx;
        font-family: PingFangSC-Semibold, PingFang SC;
        font-weight: 600;
        color: #000000;
      }
    }
  }
}

.yypop {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.yyview {
  width: 660rpx;
  background-color: #fff;
  border-radius: 50rpx;
  position: relative;
  padding: 0rpx 0 70rpx;
  margin-top: -40rpx;

  .timg {
    position: relative;
    width: 40%;
    height: 0;
    margin: -86rpx auto 0;
    display: block;
  }

  .ytit {
    color: #000;
    font-weight: bold;
    font-size: 30rpx;
    padding: 40rpx 0;
    text-align: center;
  }

  .tun {
    color: #6a6b6d;
    font-size: 28rpx;
    text-align: center;

    text {
      color: #f00;
      margin-left: 5rpx;
    }
  }

  .btns {
    display: flex;
    justify-content: space-between;
    margin-top: 60rpx;
    padding: 0 40rpx;

    /deep/ .u-btn {
      padding: 36rpx 60rpx;

      &.u-btn--info {
        background-color: transparent;
      }
    }
  }
}

//
</style>
